﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using GtsServer.DAL;
using System.Data;
using GtsServer.Common;

namespace GtsServer.Manage.Controller
{
    public class ChanceController
    {
        ChanceDAL dal = new ChanceDAL();
        public List<ChanceShow> GetListByTypeID(int typeID)
        {
            List<ChanceShow> list = new List<ChanceShow>();
            string strWhere = " typeid = " + typeID;
            DataSet ds = new DataSet();
            ds = dal.GetList(strWhere);
            list = IListDataSet.DataSetToIList<ChanceShow>(ds, 0).ToList();
            return list;
        }

        public bool Add(Chance model)
        {
            return dal.Add(model) > 0 ? true : false;
        }

        public bool UpdateChanceValue(Chance model)
        {
            return dal.UpdateChanceValue(model);
        }

        //public bool UpdateNameAndSortNum(int mouldID,int sortNum,string typeName)
        //{
        //    return dal.UpdateNameAndSortNum(mouldID, sortNum, typeName);
        //}

        public bool DeleteByTypeID(int typeID)
        {
            return dal.DeleteByTypeID(typeID);
        }

        public bool DeleteByName(int mouldId)
        {
            return dal.DeleteByChanceMouldName(mouldId);
        }
    }
}
